]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
slider: Calculate handle position in whole pixel units
authorDaniel van Vugt <daniel.van.vugt@canonical.com>
Thu, 20 Feb 2020 08:02:20 +0000 (16:02 +0800)
committerDaniel van Vugt <daniel.van.vugt@canonical.com>
Fri, 21 Feb 2020 03:29:09 +0000 (11:29 +0800)
`-slider-handle-radius` is a floating point value and even in the default
theme it's not a whole number. Regardless of the fractional part that's
still going to occupy a whole extra pixel with antialiasing. So make room
for it. Otherwise it looks clipped, which it is by the Cairo context of
its `StDrawingArea`.

Fixes https://gitlab.gnome.org/GNOME/gnome-shell/issues/1569

js/ui/slider.js

index 824cf875559e8dfb92798308fe4079b605eb6f33..01b29e1fc26db9475a15fd0e055e37d6da89decf 100644 (file)
@@ -43,7 +43,9 @@ var Slider = GObject.registerClass({
         let [hasHandleColor, handleBorderColor] =
             themeNode.lookup_color('-slider-handle-border-color', false);
 
-        let handleX = handleRadius + (width - 2 * handleRadius) * this._value / this._maxValue;
+        let wholeHandleRadius = Math.ceil(handleRadius);
+        let handleX = wholeHandleRadius +
+            (width - 2 * wholeHandleRadius) * this._value / this._maxValue;
         let handleY = height / 2;
 
         let color = themeNode.get_foreground_color();